<?php
////////////////////////////////////////////////////////////////////////////
//                                                                        //
// NOTICE OF COPYRIGHT                                                    //
//                                                                        //
// Dean`s Office for Moodle                                               //
// Электронный деканат                                                    //
// <http://deansoffice.ru/>                                               //
//                                                                        //
// Copyright (C) 2008-2999  Alex Djachenko (Алексей Дьяченко)             //
// alex-pub@my-site.ru                                                    //
// Copyright (C) 2008-2999  Evgenij Cigancov (Евгений Цыганцов)           //
// Copyright (C) 2008-2999  Ilia Smirnov (Илья Смирнов)                   //
// Copyright (C) 2008-2999  Mariya Rojayskaya (Мария Рожайская)           //
//                                                                        //
// This program is free software: you can redistribute it and/or modify   //
// it under the terms of the GNU General Public License as published by   //
// the Free Software Foundation, either version 3 of the Licensen.        //
//                                                                        //
// This program is distributed in the hope that it will be useful,        //
// but WITHOUT ANY WARRANTY; without even the implied warranty of         //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          //
// GNU General Public License for more details.                           //
//                                                                        //
// You should have received a copy of the GNU General Public License      //
// along with this program.  If not, see <http://www.gnu.org/licenses/>.  //
//                                                                        //
////////////////////////////////////////////////////////////////////////////
/*
 * Описание файла
 */

require_once('lib.php');

$DOF->modlib('nvg')->print_header(NVG_MODE_PORTAL);
$errormsg = '<font color="red"> is ERROR</font>';
$truemsg = ' is ok';
print '<br />TEST проверка получения ФИО и id куратора ';
$sql = "SELECT MAX(sellerid) as sellerid
        FROM {$CFG->prefix}block_dof_s_contracts
        WHERE sellerid IS NOT NULL AND sellerid != 0";
$sellerid = get_record_sql($sql);
$seller = new object;
$seller->id = $sellerid->sellerid;
$seller->name = $DOF->storage('persons')->get_fullname($sellerid->sellerid);
$q = array(
     array('input' => 9999999999, 'result' => false),
     array('input' => 'asd'.$sellerid->sellerid, 'result' => false),
     array('input' => $sellerid->sellerid.'asd', 'result' => false),
     array('input' => array($sellerid->sellerid), 'result' => false),
     array('input' => $sellerid->sellerid, 'result' => $seller)
          );
$rez = $truemsg;
foreach ( $q as $v )
{
    $fres = $DOF->storage('contracts')->get_seller($v['input']);
    if ( $fres != $v['result'] )
    {
        $rez = $errormsg;
        print_object($fres);
        print_object($v['result']);
    }
}
print $rez;
          
          
$DOF->modlib('nvg')->print_footer(NVG_MODE_PORTAL);
?>